//
//  ExamtionModel.m
//  Arts1
//
//  Created by 孤星晨宇 on 15/10/14.
//  Copyright © 2015年 Arts1. All rights reserved.
//

#import "ExamtionModel.h"

@implementation ExamtionModel

- (void)setValue:(id)value forUndefinedKey:(NSString *)key{

}

- (void)setValue:(id)value forKey:(NSString *)key{
    [super setValue:value forKey:key];
    if ([key isEqualToString:@"examTime"]) {
        // 将秒转换为NSDate类型
        NSDate *date = [NSDate date];
        [date dateByAddingTimeInterval:[value integerValue]];
        
        //  按照给定格式输出
        NSDateFormatter *formatter = [[NSDateFormatter alloc] init];
        [formatter setDateFormat:@"yyyy年MM月dd日"];
        
        //获取系统的时间区域
        formatter.timeZone = [NSTimeZone systemTimeZone];
        //设定本地化，时间会按照本地的习惯和文字显示日期
        formatter.locale = [[NSLocale alloc] initWithLocaleIdentifier:@"en-us"];
        
        NSString* str = [formatter stringFromDate:date];
        self.examTime = [NSString stringWithFormat:@"考试时间 ：%@ ",str];
    }
}

@end
